package com.foreveross.taskservice.application.impl.pages;

import java.util.Collection;
import java.util.List;

import org.apache.commons.collections.CollectionUtils;

import com.foreveross.taskservice.application.task.statsdetail.vo.BaseChannelVO;
import com.foreveross.taskservice.application.task.statsdetail.vo.BaseTaskVO;
import com.foreveross.taskservice.common.model.AbstractChannelModel;
import com.foreveross.taskservice.common.model.AbstractTaskModel;
import com.google.common.collect.Lists;

/**
 * 将常见的模型变成vo
 * @author guokenye
 *
 */
public class PageVOBuilder {

	static List<BaseTaskVO> buildTaskModesl2TaskVOs(Collection<AbstractTaskModel> models){
		List<BaseTaskVO> vos=Lists.newArrayList();
		if(CollectionUtils.isNotEmpty(models)){
			for(AbstractTaskModel m:models){
				vos.add(buildTaskModel2TaskVO(m));
			}
		}
		return vos;
	}
	
	static BaseTaskVO buildTaskModel2TaskVO(AbstractTaskModel model){
		BaseTaskVO vo=new BaseTaskVO(model);
		return vo;
	}
	
	static List<BaseChannelVO> buildChannelModels2ChannelVOs(Collection<AbstractChannelModel> models){
		List<BaseChannelVO>  vos=Lists.newArrayList();
		if(CollectionUtils.isNotEmpty(models)){
			for(AbstractChannelModel m:models){
				vos.add(buildChannelModel2ChannelVO(m));
			}
		}
		return vos;
	}
	
	static BaseChannelVO buildChannelModel2ChannelVO(AbstractChannelModel model){
		BaseChannelVO vo=new BaseChannelVO(model);
		return vo;
	}
	
	
}
